package netcore.protocol.CharMessage
{
    import flash.utils.ByteArray;
    import netcore.net.ProtocolBuffer;
    import netcore.net.INT64;
    import netcore.net.UINT64;
    import netcore.protocol.MessageType;
    
    // 创建角色
    public class NotifyCharBasicMessage
    {
        public static const THIS_MSG_TYPE:int = MessageType.MSG_NOTIFY_CHAR_BASIC;
        import netcore.protocol.BulkDataType.CHAR_BASIC;
        public var char_basic:CHAR_BASIC;
        import netcore.protocol.BulkDataType.CHAR_BASIC;
        public var other_basic:Array; /* array of CHAR_BASIC */
        public function readFromStream(stream:ByteArray):void
        {
            char_basic = new CHAR_BASIC; char_basic.readFromStream(stream);
            var length2:int = stream.readUnsignedShort();
            other_basic = [];
            for(var i2:int = 0; i2 < length2; i2++)
            {
                other_basic[i2] = new CHAR_BASIC; other_basic[i2].readFromStream(stream);
            }
        }
        
        public function writeToStream(stream:ByteArray):void
        {
            char_basic.writeToStream(stream);
            stream.writeShort(other_basic.length);
            for(var i2:int = 0; i2 < other_basic.length; i2++)
            {
                other_basic[i2].writeToStream(stream);
            }
        }
        
        public function buildPacket():ByteArray
        {
            var abuff:ByteArray = ProtocolBuffer.NewBuffer();
            abuff.writeShort(THIS_MSG_TYPE);
            abuff.writeUnsignedInt(0);
            abuff.writeUnsignedInt(0);
            abuff.writeUnsignedInt(0);
            writeToStream(abuff);
            return abuff;
        }
        
    }
}
